package filter

import (
	"github.com/gin-gonic/gin"
)

// 实现一个错误的包装中间件
func ErrorWrapper(c *gin.Context) {
	defer func() {
		if err := recover(); err != nil {
			c.JSON(500, gin.H{"msg": err.(error).Error()})
		}
	}()
	c.Next()
}
